#pragma once

#include <atomic>
#include <iostream>
#include <string>
#include <thread>
#include <cstring>
#include <cerrno>
#include <cstdlib>
#include <fcntl.h>
#include <sys/stat.h>
#include "err.hpp"
#include "../easysock.hpp"

namespace udp
{

class udp_client : public inet::udp::client
{
public:
    udp_client(const std::string& sip, uint16_t sport)
        : client(sip, sport)
    {}

    void init_server()
    {
    }

    ~udp_client()
    {
    }

    void start()
    {
            std::string msg;
            std::cerr << "please input:> ";
            getline(std::cin, msg);
            sendto(msg);

            std::string rsp;
            ssize_t s = recvfrom(&rsp, 1024);

            std::cout << "server echo# " << rsp << std::endl;
    }

private:
};

}
